import store from "../store/index.js"

function hasLogin(){
	if(store.state.user.userInfo == null){
		let has = location.hash
		
		let path = has.substring(1,has.length)
		path = '/pages/login/login?path=' + path
		uni.showToast({
			icon:"none",
			title:"请先去登录吧",
			duration:1500
		})
		let t = setTimeout(()=>{
			uni.redirectTo({
				url:path
			})
		},1500)
		return false
	}else {
		return true
	}
}


function hasUserInfo(){
	if(store.state.user.userInfo == null || !(store.state.user.userInfo.hasOwnProperty("photo"))){
		uni.switchTab({
			url:"/pages/index/nime"
		})
		return false
	}else {
		return true
	}
}

export {
	hasLogin,hasUserInfo
}